import request from '/@/utils/request';

/**
 * OIDC 客户端管理 API
 */

// 获取客户端列表
export function getClientList(params: any) {
  return request({
    url: '/oidc/admin/clients',
    method: 'get',
    params,
  });
}

// 创建客户端
export function createClient(data: any) {
  return request({
    url: '/oidc/admin/clients',
    method: 'post',
    data,
  });
}

// 获取客户端详情
export function getClientDetail(id: string) {
  return request({
    url: `/oidc/admin/client`,
    method: 'get',
    params: {
      clientId: id,
    },
  });
}

// 更新客户端
export function updateClient(id: string, data: any) {
  return request({
    url: `/oidc/admin/clients`,
    method: 'put',
    params: {
      id: id,
    },
    data,
  });
}

// 删除客户端
export function deleteClient(id: string) {
  return request({
    url: `/oidc/admin/clients`,
    method: 'delete',
    params: {
      id: id,
    },
  });
}

// 重新生成客户端密钥
export function regenerateClientSecret(id: string) {
  return request({
    url: `/oidc/admin/clients/regenerate-secret`,
    method: 'post',
    params: {
      id: id,
    },
  });
}